Ruby On Rails Interview Questions

Ratings:
(4)
Views: 730
Banner-Img
Share this blog:

 

Ruby On Rails Interview Questions and Answers

1. Explain about ruby?

Ans. Ruby is a high-level programming language like Perl and python, and ruby is also an object-oriented programming language like Smalltalk, Java and ADA in simple words ruby is a blend of conceptual elegance of Smalltalk, ease of python and pragmatism of Perl.

2. Explain about rail?

Ans. Rail is an extremely productive framework of the web-application rail written in ruby, and we can develop web applications very much faster with rails when we are using rails there is no need of compilation. We can just configure our code with the database schema. 

3. Is ruby on rails important? 

Ans. If you obtain complete advantage of Ruby on Rails, you will be capable of developing complex applications in very less time. And we must not ignore that Ruby On Rails(ROR) contains extensive gems which several modern technologies do not possess. Therefore, ruby on rails is deserving of acquiring the knowledge on ROR(Ruby On Rails).

4. What are the disadvantages of using Ruby?

Ans. There are two main disadvantages to using ruby.

  1. Performance issues though it resembles Python and Perl, Ruby is, however, a paraphrased language also we should not resemble it among high-level programming languages like C++ or C.   

  2. Threading model Ruby does not practice primary threads. Ruby threads are assumed within the VM preferably than operating as primary Operating System threads. 

5. Mention a few advantages of rails? 

Ans. Advantages of Rails are

  • Active record is a framework which stores objects in the database; this rails active record finds the columns within the database schema and automatically blends them with the domain objects with metaprogramming.
  •  Scaffolding developer frequently develops a temporary code in the initial stages of development, and this helps to develop the application quickly and check how the important components are working together. 
  • Convention over configuration many web development frameworks like Java or .NET demands you to write a lengthy configuration code but rails never demand or need much configuration code.

6. List environments of Rails?

Ans. Rails provide us with three environments they are:

  • Development
  • Testing
  • Production

7. Explain about embedded Ruby?

Ans. Embedded ruby is prepared in the backend before sending a request to the web browser. Embedded ruby lets you keep the ruby codes within the HTML file, embedded ruby checks every line, and at a point when the ERB came across the ruby code which is embedded in the document, it begins executing the code.

8. Explain about ORM in Rails?

Ans. ORM is abbreviated as Object Relational Mapper when you are using ORM there is no need to call the database manually, ORM implies an active record that retrieves the data that is stored within the database by using columns and rows for example if you want to retrieve the data of all the students then instead of writing code to connect the database and then writing the SQL query like SELECT * FROM students and then obtaining the result within an array you can simply write students.all and this active record gives all the student information that I want to know.

9. Explain bout MVC framework?

Ans. MVC framework in ruby on rails breaks the work into three separate yet cooperative subsystems the MVC is abbreviated as Model View Controller 

The three subsystems are

Model: an active record which maintains the relations among database and objects and Model also handles transactions, validation, association and so on.

View: an action view is a presentation of data in a specific format triggered through a controller determination to impersonate the data. These are sprint-based systems like PHP, ASP, JSP and quite simple to integrate with AJAX technology.

Controller: an action controller is fluency in the application that manages the traffic, querying the models for particular data and on the other hand it also sorts, searches and messages the data into a specific form that suits the requirements of an assigned view.

10. What are the benefits of using rails Migration?

Ans. Benefits of using rails migration are

  • Create_table
  • Drop_table
  • Add_coloumn
  • Change_coloumn
  • Rename_coloumn
  • Rename_table
  • Add_index
  • Remove_index
  • remove_coloumn          

11. List the data types of migrations?

Ans. There are eight basic types of migrations 

  • Integer
  • Text
  • String
  • Data and time
  • Float
  • Boolean
  • Binary
  • Timestamp and DateTime

12. Explain about rake file?

Ans. A rake is a native tool used in ruby, the rake is very similar to make in Unix rake is utilised to handle administrative tasks or commands these are stores either on a rake file or within a .rake file. Rake lets us write the tasks in RUBY and execute them upon a command line.

13. Explain about rake db reset?

Ans. Rake db: reset drops the database and loads the schema with and load the schema with rake db:scheme: load and after that it seeds the data by using 

rake db: seed.

14. List the features of Object-Oriented Programming language?

Ans. The four important characteristics or features of Object-Oriented programming language 

  • Data Encapsulation is also recognised as data hiding this mechanism hides all the implementation specifications of the class are held hidden from the users.
  • Data abstraction is a reduction of a specific part of data into a simple form.
  • Polymorphism is a Greek word where poly means many and morphism means form, so in simple words, polymorphism means the capability of an object to take many forms.
  • Inheritance is a mechanism that one object gets the properties of the other object, the object which gets the properties are called child object and the object which gives the properties is called the parent object.       

15. List the types of variables?

Ans. There are four types of variables. 

  • Local variables are the variables that are declared within a particular method they are not available to use outside that particular method. 
  • Instance, variables are accessible over methods toward any appropriate object or instance.
  • Class variables these variables are accessible within a class over different objects.
  • Global variables these variables are available all over the program it means we can access these variables anywhere within the program.  

16. Explain about render?

Ans. Render produces rails to create an acknowledgement whose content is given by rendering one of the templates. Which means it will instantly go to the view page.

17. Explain about Redirect_to?

Ans. Redirect_to produces an acknowledgement that, alternatively of delivering content through the browser, simply explains it to inquire different URL. Means it initially checks activities within the controller also then moves towards the view page.

18. Explain about rails filters?

Ans. The methods that run after or before the controllers' action method got executed. They are necessary when you desire to guarantee that each presented section of code runs beside whatever the action method is called. 

19. What are the types of filters?

Ans. There are three types of filters.

  • Before filters, these filters get executed even before the action controller execute these filters are defined above the controller class, which calls them. 
  • After filters, these filters get executed after the action controller get execute these after filters are defined above the controller class which calls them.
  • Around filters, these filters get executed both before and after the controllers' code get executed.

20. What does the standard ORM model contain?

Ans. The standard ORM model contains

  • Table that maps to classes 
  • Rows that maps to objects
  • Columns that maps to object attributes

 21. Explain about a Gemfile?

Ans. A Gemfile is a kind of file we design which is utilised for defining gem mandates to Ruby programs. A gem is an acquisition of Ruby code that we will obtain within any "collection" that we can call afterwards. It allows you to designate which gems you desire to practice, and which variants of those gems to practice.

22. Explain about 'fat model, skinny controller' in ruby on rails?

Ans. 'Fat Model, Skinny Controller' alludes to how the M and C parts of MVC in a perfect world work together. In particular, any non-reaction related rationale ought to go in the Model, preferably in a pleasant, testable technique. In the interim, the "inside scoop" controller is essentially a pleasant interface between the view and Model. 

By and by, this can require a scope of various sorts of refactoring. Yet, everything boils down to one thought: by moving any rationale that isn't about the reaction to the Model (rather than the controller), have you advanced reuse where conceivable as well as made it conceivable to test your code outside of the setting of a solicitation.

 23. What are the symbols used to begin the three types of variables?

Ans.

  • A local variable of ruby begin with @
  • The global variable of ruby begins with $
  • The class variable of ruby begin with @@

24. Explain about a module?

Ans. A module is a group of constants, class variables and methods.

25. Explain about PORO?

Ans. PORO is abbreviated as Plain Old Ruby Object is being utilised more frequently nowadays. In a remark on my last post, somebody communicated disappointment that I didn't approve the abbreviation. After a snappy Google search, I saw that nobody had made a special effort to bring up its significance.

26. What are rails Observers?

Ans. Observers are similar to the callback. However, it is utilised when the strategy isn't straightforwardly related to question lifecycle. Likewise, the spectator stays longer, and also it very well may be disengaged or appended whenever. For instance, showing esteems from one Model in the UI and refreshing model from client input.

27. What is rails callback?

Ans. Callbacks are the type of methods by which we can be called at specific snapshots of an article's life cycle, for instance, it very well may be considered when an item is approved, made, refreshed, erased, A get back to is brief. For instance, running a string and we can give a call back to which is called when string ends.

28. How to list all the routes for any application?

Ans. We can list all the routes for any application by writing rake routes within the terminal

29. What is a sweeper?

Ans. A sweeper is used for terminating pr removing the caches whenever the model object is changed.

30. List the domains that have relevant class libraries?

Ans.

  • GUI programming
  • CGI programming
  • Network programming
  • Text processing

You liked the article?

Like: 0

Vote for difficulty

Current difficulty (Avg): Medium

EasyMediumHardDifficultExpert
IMPROVE ARTICLEReport Issue

About Author

Authorlogo
Name
TekSlate
Author Bio

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.

Stay Updated
Get stories of change makers and innovators from the startup ecosystem in your inbox